package algorithm.sort;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;

public class InputSequence {
	public static int[] inputIntArray() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		System.out.println("请输入一个整数序列（以空格隔开）：");
		String[] strs = br.readLine().split(" ");
		int[] arr = new int[strs.length];
		for(int i = 0; i < strs.length; i++)
	     	arr[i] = Integer.parseInt(strs[i]);
		return arr;
	}
	
	public static int[] randomIntArray(int elementNum, int start, int end) {
		int[] arr = new int[elementNum];
		Random random = new Random();
		for(int i = 0, bound = end - start; i < elementNum; i++)
			arr[i] = random.nextInt(bound) + start;
		return arr;
	}
	
	public static int[] randomIntArray(int elementNum, int end) {
		return randomIntArray(elementNum, 0, end);
	}
	public static int[] randomIntArray(int elementNum) {
		return randomIntArray(elementNum, 0, 10);
	}
}
